package Month07.day28;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class test5 {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>(List.of("盖伦","嘉文四世","拉克丝","奎因","菲奥娜","赵信"));
        ArrayList<String> list1 = new ArrayList<>(List.of("德莱厄斯","德莱文","沙弥啦","瑞文","斯维因","乐芙兰"));
        Stream<String> stream = list.stream().limit(6).filter(s -> s.length() == 3);
        Stream<String> stream1 = list1.stream().filter(s -> s.startsWith("德")).skip(1);
        List<String> collect = Stream.concat(stream, stream1).collect(Collectors.toList());
        Lol lol = new Lol();
//        for (String s : collect) {
//            lol.setName(s);
//        }
        Iterator<String> iterator = collect.iterator();
        while (iterator.hasNext()){
            String s = iterator.next();
            lol.setName(s);
        }
        System.out.println(lol.getName());
    }

}
class Lol{
    private String name;

    public Lol() {
    }

    public Lol(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Lol lol = (Lol) o;
        return Objects.equals(name, lol.name);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name);
    }

    @Override
    public String toString() {
        return "Lol{" +
                "name='" + name + '\'' +
                '}';
    }
}
